#!/usr/bin/env python

class Expense:
   def __init__(self, Amnt, Descrip, Trans, Acct):
      self.Amount = Amnt
      self.Description = Descrip
      self.Transfer = Trans
      Acct.addExpense(self)

class Income:
   def __init__(self, Amnt, Descrip, Trans, Acct):
      self.Amount = Amnt
      self.Description = Descrip
      self.Transfer = Trans
      Acct.addIncome(self)

class Transfer:
    def __init__(self, FromAcct, ToAcct, Amnt):
       newExpense = Expense(Amnt, "Transfer", True, FromAcct)
       newIncome = Income(Amnt, "Transfer", True, ToAcct)

class Account:
   def __init__(self, AccntName):
      self.Name = AccntName
      self.Balance = 0
      self.IncomeList = []
      self.ExpenseList = []

   def __repr__(self):
      return self.Name + " = $" + str(self.Balance)

   def balAccount(self):
      tempBal = 0

      for Incm in self.IncomeList:
         tempBal = tempBal + Incm.Amount
      for Expn in self.ExpenseList:
         tempBal = tempBal - Expn.Amount

      self.Balance = tempBal

   def addIncome(self, Incm):
      self.IncomeList.append(Incm)
      self.balAccount()

   def addExpense(self, Expn):
      self.ExpenseList.append(Expn)
      self.balAccount()

   def printAccount(self):
      print "\n" + self.Name + " Account"

      print "\n   " + "Income: \n"
      for Incm in self.IncomeList:
         print "      " + Incm.Description + "\t$" + str(Incm.Amount)

      print "\n   " + "Expense: \n"
      for Expn in self.ExpenseList:
         print "      " + Expn.Description + "\t$" + str(Expn.Amount)

      print "\n   " + "Total: \t$" + str(self.Balance)

class Main:
   Acct1 = Account("Checking")
   Acct2 = Account("Savings")

   Incm1 = Income(100, "Drugs", False, Acct1)
   Expn1 = Expense(50, "Ho's", False, Acct1)
   Expn2 = Expense(20, "Food", False, Acct1)
   Incm2 = Income(500, "Pimpin", False, Acct2)
   Expn3 = Expense(200, "Baby Mama", False, Acct2)

   t = Transfer(Acct1, Acct2, 20)

   AccountList = [Acct1, Acct2]
   print AccountList

   for Acct in AccountList:
      Acct.printAccount()








